package com.obtk.property.controller;

import com.obtk.property.pojo.Category;
import com.obtk.property.pojo.Complaint;
import com.obtk.property.service.CategoryService;
import com.obtk.property.service.ComplaintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @Autowired
    private ComplaintService complaintService;

    @RequestMapping("/{a}")
    public  String test(@PathVariable("a") String a,Model model){
        List<Category> category=categoryService.getCategory();
        model.addAttribute("list",category);

        Complaint complaint = new Complaint();
        Integer complaintCount=complaintService.selectCount(complaint);
        model.addAttribute("complaintCount",complaintCount);


        System.out.println(a);




        return a;
    }


}
